package com.xiaotou.domain.impl;

import com.xiaotou.db.pojo.ActingCareer;
import com.xiaotou.db.pojo.AppUser;
import com.xiaotou.domain.Engine;
import com.xiaotou.domain.Police;
import com.xiaotou.domain.Roles;
import com.xiaotou.domain.SkillLevel;
import com.xiaotou.weibo.WeiboUser;

public class PoliceImpl implements Police {

	private Engine engine;

	private WeiboUser actor;

	public PoliceImpl(WeiboUser actor) {
		this.actor = actor;
	}

	@Override
	public WeiboUser getActor() {
		return actor;
	}

	public void setEngine(Engine engine) {
		this.engine = engine;
	}

	@Override
	public ActingCareer getActingCareer() {
		final AppUser appUser = this.actor.getWbUser().getAppUser();
		if (appUser != null) {
			return appUser.getActingCareers().get(Roles.Police.getValue());
		} else {
			return null;
		}
	}

	@Override
	public SkillLevel getSkillLevel() {
		return this.engine.getSkillLevel(this);
	}

}
